﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using WLWZGao6.APItitlion.IService;
using WLWZGao6.Domain.Common;
using WLWZGao6.Domain.Model;
using WLWZGao6.Domain.IRepository;
using WLWZGao6.Domain.Dto;


namespace WLWZGao6.APItitlion.Service
{
    public class RoleService :IRoleService
    {
        public IRoleRepository _roleRepository;
        public RoleService (IRoleRepository roleRepository)
        {
            _roleRepository = roleRepository;
        }

        public EData RoleAdd(Role role)
        {
            return _roleRepository.RoleAdd(role);
        }

        public EData RoleDel(int Ids)
        {
            return _roleRepository.RoleDel(Ids);
        }

        public EData RoleShow(string RoleName, int Index, int Size)
        {
            return _roleRepository.RoleShow(RoleName,Index,Size);
        }

        public EData RoleUpd(int Ids, Role role)
        {
            return _roleRepository.RoleUpd(Ids, role);
        }

        public EData UserRoleAdd(UserRole userRole)
        {
            return _roleRepository.UserRoleAdd(userRole);
        }

        public EData UserRoleDel(int Ids)
        {
            return _roleRepository.UserRoleDel(Ids);
        }
        /// <summary>
        /// 角色权限显示
        /// </summary>
        /// <returns></returns>
        public EData RolePermShow()
        {
            return _roleRepository.RolePermShow();
        }
        /// <summary>
        /// 角色权限添加
        /// </summary>
        /// <param name="rolePremDto"></param>
        /// <returns></returns>
        public EData RolePermAdd(RolePremDto rolePremDto)
        {
            return _roleRepository.RolePermAdd(rolePremDto);
        }
        /// <summary>
        /// 角色权限编辑
        /// </summary>
        /// <param name="Ids"></param>
        /// <param name="PermId"></param>
        /// <returns></returns>
        public EData RolePermUpt(int Ids, string PermId)
        {
            return _roleRepository.RolePermUpt(Ids, PermId);
        }
        /// <summary>
        /// 角色权限删除
        /// </summary>
        /// <param name="Ids"></param>
        /// <returns></returns>
        public EData RolePermDel(int Ids)
        {
            return _roleRepository.RolePermDel(Ids);
        }
        /// <summary>
        /// 递归权限显示
        /// </summary>
        /// <returns></returns>
        public List<PermDto> PermShow()
        {
            return _roleRepository.PermShow();
        }
        public List<PermDto> PermTypeShow(List<Perm> perms, int Ids = 0)
        {
            return _roleRepository.PermTypeShow(perms, Ids);
        }
    }
}
